package com.houtai.controller.dict;

import com.houtai.authority.Authority;
import com.houtai.authority.AuthorityType;
import com.houtai.base.RetInfo;
import com.houtai.service.dict.DictService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@Controller
@RequestMapping(value = {"v6"})
public class DictController {
    @Resource
    private DictService dictService;

    /**
     * @Purpose   获取所有子数据
     * @param     parent_id
     * @version   1.0
     * @author    李准
     * @time      2017-08-19
     * @return    RetInfo
     */
    @RequestMapping(value = "/dict/son/all", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    @Authority(AuthorityType.Login)
    public RetInfo all(Integer parent_id, HttpServletRequest request) {
        RetInfo retInfo = new RetInfo();
        retInfo.setMark("0");
        retInfo.setObj(dictService.findAllDictByParentId(parent_id));
        return retInfo;
    }

}
